Skip to content

Commit

Permalink
refactor: remove unuse sdk version field. (#616)
Browse files Browse the repository at this point in the history
* refactor: remove unuse sdk version field.

* update reLog field.

* fix: add necessary field.

* Update log.go

---------

Co-authored-by: OpenIM-Gordon <[email protected]>
  • Loading branch information
mo3et and FGadvancer authored Jul 26, 2024
1 parent 95fa949 commit c174891
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 30 deletions.
15 changes: 8 additions & 7 deletions internal/third/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ package third
import (
"context"
"fmt"
"github.com/openimsdk/openim-sdk-core/v3/internal/file"
"github.com/openimsdk/openim-sdk-core/v3/internal/util"
"github.com/openimsdk/openim-sdk-core/v3/pkg/ccontext"
"github.com/openimsdk/openim-sdk-core/v3/pkg/constant"
"github.com/openimsdk/protocol/third"
"github.com/openimsdk/tools/errs"
"io"
"math/rand"
"os"
"path/filepath"
"strings"
"time"
"github.com/openimsdk/openim-sdk-core/v3/internal/file"
"github.com/openimsdk/openim-sdk-core/v3/internal/util"
"github.com/openimsdk/openim-sdk-core/v3/pkg/ccontext"
"github.com/openimsdk/openim-sdk-core/v3/pkg/constant"
"github.com/openimsdk/openim-sdk-core/v3/version"
"github.com/openimsdk/protocol/third"
"github.com/openimsdk/tools/errs"
)

func (c *Third) UploadLogs(ctx context.Context, ex string, progress Progress) error {
Expand Down Expand Up @@ -51,7 +52,7 @@ func (c *Third) UploadLogs(ctx context.Context, ex string, progress Progress) er
reqLog := &third.UploadLogsReq{
Platform: c.platformID,
SystemType: c.systemType,
Version: c.version,
Version: version.Version,
FileURLs: []*third.FileURL{{Filename: zippath, URL: resp.URL}},
Ex: ex,
}
Expand Down
8 changes: 4 additions & 4 deletions internal/third/third.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ package third

import (
"context"
"sync"

"github.com/openimsdk/openim-sdk-core/v3/internal/file"
"github.com/openimsdk/openim-sdk-core/v3/internal/util"
"github.com/openimsdk/openim-sdk-core/v3/pkg/constant"
"github.com/openimsdk/protocol/third"
"sync"
)

type Third struct {
platformID int32
loginUserID string
version string
systemType string
LogFilePath string
fileUploader *file.File
logUploadLock sync.Mutex
}

func NewThird(platformID int32, loginUserID, version, systemType, LogFilePath string, fileUploader *file.File) *Third {
return &Third{platformID: platformID, loginUserID: loginUserID, version: version, systemType: systemType, LogFilePath: LogFilePath, fileUploader: fileUploader}
func NewThird(platformID int32, loginUserID, systemType, LogFilePath string, fileUploader *file.File) *Third {
return &Third{platformID: platformID, loginUserID: loginUserID, systemType: systemType, LogFilePath: LogFilePath, fileUploader: fileUploader}
}

func (c *Third) UpdateFcmToken(ctx context.Context, fcmToken string, expireTime int64) error {
Expand Down
10 changes: 1 addition & 9 deletions open_im_sdk/init_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,11 @@ import (
"github.com/openimsdk/tools/mcontext"
)

func GetSdkVersion() string {
return constant.GetSdkVersion()
}

const (
rotateCount uint = 0
rotationTime uint = 24
)

func SetHeartbeatInterval(heartbeatInterval int) {
constant.HeartbeatInterval = heartbeatInterval
}

func InitSDK(listener open_im_sdk_callback.OnConnListener, operationID string, config string) bool {
if UserForSDK != nil {
fmt.Println(operationID, "Initialize multiple times, use the existing ", UserForSDK, " Previous configuration ", UserForSDK.ImConfig(), " now configuration: ", config)
Expand Down Expand Up @@ -71,7 +63,7 @@ func InitSDK(listener open_im_sdk_callback.OnConnListener, operationID string, c
return false
}

log.ZInfo(ctx, "InitSDK info", "config", configArgs, "sdkVersion", GetSdkVersion())
log.ZInfo(ctx, "InitSDK info", "config", configArgs)
if listener == nil || config == "" {
log.ZError(ctx, "listener or config is nil", nil)
return false
Expand Down
2 changes: 1 addition & 1 deletion open_im_sdk/userRelated.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func (u *LoginMgr) login(ctx context.Context, userID, token string) error {
u.group = group.NewGroup(u.loginUserID, u.db, u.conversationCh)
u.full = full.NewFull(u.user, u.friend, u.group, u.conversationCh, u.db)
u.business = business.NewBusiness(u.db)
u.third = third.NewThird(u.info.PlatformID, u.loginUserID, constant.SdkVersion, u.info.SystemType, u.info.LogFilePath, u.file)
u.third = third.NewThird(u.info.PlatformID, u.loginUserID, u.info.SystemType, u.info.LogFilePath, u.file)
log.ZDebug(ctx, "forcedSynchronization success...", "login cost time: ", time.Since(t1))

u.msgSyncer, _ = interaction.NewMsgSyncer(ctx, u.conversationCh, u.pushMsgAndMaxSeqCh, u.loginUserID, u.longConnMgr, u.db, 0)
Expand Down
9 changes: 0 additions & 9 deletions pkg/constant/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,6 @@ const (
)

const BigVersion = "v3"
const UpdateVersion = ".0.0"
const SdkVersion = "openim-sdk-core-"
const LogFileName = "sdk"

func GetSdkVersion() string {
return SdkVersion + BigVersion + UpdateVersion
}

var HeartbeatInterval = 5

const (
MsgSyncModelDefault = 0 //SyncFlag
Expand Down

0 comments on commit c174891

Please sign in to comment.