Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
overtake committed Aug 18, 2015
1 parent 5b775f8 commit 8ef5497
Show file tree
Hide file tree
Showing 25 changed files with 190 additions and 171 deletions.
Binary file modified .DS_Store
Binary file not shown.
21 changes: 18 additions & 3 deletions TGShare/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,34 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.80</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>24732</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<string>TRUEPREDICATE</string>
<dict>
<key>NSExtensionActivationSupportsAttachmentsWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsAttachmentsWithMinCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsFileWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsText</key>
<true/>
<key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
</dict>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
Expand Down
66 changes: 47 additions & 19 deletions TGShare/TGSEnterPasscodeView.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
#import "TGS_MTNetwork.h"
#import "TGImageView.h"
#import "TGSImageObject.h"
#import "ShareViewController.h"
@interface TGSEnterPasscodeView ()
@property (nonatomic,strong) NSSecureTextField *secureField;
@property (nonatomic,strong) BTRButton *enterButton;
@property (nonatomic,strong) TGImageView *avatar;
@property (nonatomic,strong) BTRButton *cancelButton;
@end

@implementation TGSEnterPasscodeView
Expand All @@ -34,24 +36,24 @@ -(instancetype)initWithFrame:(NSRect)frameRect {



_avatar = [[TGImageView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];


[_avatar setCenterByView:self];

[_avatar setFrameOrigin:NSMakePoint(NSMinX(_avatar.frame), NSMinY(_avatar.frame) + 50)];

[self addSubview:_avatar];

TLUser *user = [ClassStore deserialize:[[TGSAppManager standartUserDefaults] objectForKey:@"selfUser"]];

TGSImageObject *imageObject = [[TGSImageObject alloc] initWithLocation:user.photo.photo_small];

imageObject.imageSize = NSMakeSize(100, 100);

_avatar.object = imageObject;


// _avatar = [[TGImageView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
//
//
// [_avatar setCenterByView:self];
//
// [_avatar setFrameOrigin:NSMakePoint(NSMinX(_avatar.frame), NSMinY(_avatar.frame) + 50)];
//
// [self addSubview:_avatar];
//
// TLUser *user = [ClassStore deserialize:[[TGSAppManager standartUserDefaults] objectForKey:@"selfUser"]];
//
// TGSImageObject *imageObject = [[TGSImageObject alloc] initWithLocation:user.photo.photo_small];
//
// imageObject.imageSize = NSMakeSize(100, 100);
//
// _avatar.object = imageObject;
//
//

self.backgroundColor = [NSColor whiteColor];

Expand Down Expand Up @@ -98,7 +100,7 @@ -(instancetype)initWithFrame:(NSRect)frameRect {

[self.secureField setCenterByView:self];

[self.secureField setFrameOrigin:NSMakePoint(NSMinX(_secureField.frame), NSMinY(_secureField.frame) - 30)];
// [self.secureField setFrameOrigin:NSMakePoint(NSMinX(_secureField.frame), NSMinY(_secureField.frame) - 30)];


[self addSubview:self.secureField];
Expand All @@ -121,6 +123,32 @@ -(instancetype)initWithFrame:(NSRect)frameRect {
[self.enterButton setFrameOrigin:NSMakePoint(NSMaxX(self.secureField.frame) + 20, NSMinY(self.secureField.frame) + 3)];

[self addSubview:self.enterButton];



_cancelButton = [[BTRButton alloc] initWithFrame:NSMakeRect(NSWidth(_cancelButton.frame), 0, NSWidth(self.frame), 50)];

_cancelButton.layer.backgroundColor = [NSColor whiteColor].CGColor;

[_cancelButton setTitleColor:LINK_COLOR forControlState:BTRControlStateNormal];

[_cancelButton setTitle:NSLocalizedString(@"Cancel", nil) forControlState:BTRControlStateNormal];

[_cancelButton addBlock:^(BTRControlEvents events) {

[ShareViewController close];


} forControlEvents:BTRControlEventClick];

[self addSubview:_cancelButton];

TMView *topSeparator = [[TMView alloc] initWithFrame:NSMakeRect(0, 49, NSWidth(self.frame), DIALOG_BORDER_WIDTH)];

topSeparator.backgroundColor = DIALOG_BORDER_COLOR;

[self addSubview:topSeparator];

}

return self;
Expand Down
15 changes: 4 additions & 11 deletions TGShare/TGSModalSenderView.m
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ -(void)performMediaRequest:(id)media rowItem:(TGS_ConversationRowItem *)rowItem

_cs_count++;

id request = [TGS_RPCRequest sendRequest:[TLAPI_messages_sendMedia createWithFlags:0 peer:[self inputPeer:rowItem] reply_to_msg_id:0 media:media random_id:rand_long()] successHandler:^(id request, TLUpdates *response) {
id request = [TGS_RPCRequest sendRequest:[TLAPI_messages_sendMedia createWithFlags:0 peer:[self inputPeer:rowItem] reply_to_msg_id:0 media:media random_id:rand_long() reply_markup:nil] successHandler:^(id request, TLUpdates *response) {

_sent_count++;

Expand Down Expand Up @@ -289,7 +289,7 @@ -(void)sendAsMessage:(NSString *)message rowItem:(TGS_ConversationRowItem *)rowI
[self updateProgress:30];
}];

id request = [TGS_RPCRequest sendRequest:[TLAPI_messages_sendMessage createWithFlags:0 peer:[self inputPeer:rowItem] reply_to_msg_id:0 message:message random_id:rand_long()] successHandler:^(TGS_RPCRequest *request, id response) {
id request = [TGS_RPCRequest sendRequest:[TLAPI_messages_sendMessage createWithFlags:0 peer:[self inputPeer:rowItem] reply_to_msg_id:0 message:message random_id:rand_long() reply_markup:nil entities:nil] successHandler:^(TGS_RPCRequest *request, id response) {

_cs_count++;

Expand All @@ -315,15 +315,8 @@ -(id)inputPeer:(TGS_ConversationRowItem *)rowItem {
input = [TL_inputPeerChat createWithChat_id:rowItem.chat.n_id];
} else {

if([rowItem.user isKindOfClass:[TL_userContact class]]) {
input = [TL_inputPeerContact createWithUser_id:rowItem.user.n_id];
} else if([rowItem.user isKindOfClass:[TL_userDeleted class]] || [rowItem.user isKindOfClass:[TL_userEmpty class]]) {
input = [TL_inputPeerEmpty create];
} else if([rowItem.user isKindOfClass:[TL_userForeign class]] || [rowItem.user isKindOfClass:[TL_userRequest class]]) {
input = [TL_inputPeerForeign createWithUser_id:rowItem.user.n_id access_hash:rowItem.user.access_hash];
} else if([rowItem.user isKindOfClass:[TL_userSelf class]]) {
input = [TL_inputPeerSelf create];
}
return [TL_inputUser createWithUser_id:rowItem.user.n_id access_hash:rowItem.user.access_hash];

}
if(!input)
return [TL_inputPeerEmpty create];
Expand Down
10 changes: 10 additions & 0 deletions TGShare/TGS_ConversationRowItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#import "TMAttributedString.h"
#import "TGS_MTNetwork.h"
#import "TGDateUtils.h"



@implementation TGS_ConversationRowItem

-(id)initWithConversation:(TLDialog *)conversation user:(TLUser *)user {
Expand All @@ -37,6 +40,13 @@ -(id)initWithConversation:(TLDialog *)conversation chat:(TLChat *)chat {
-(void)configure {
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] init];


if(!_user.first_name)
_user.first_name = @"";

if(!_user.last_name)
_user.last_name = @"";

[attr appendString:_user ? [NSString stringWithFormat:@"%@ %@",_user.first_name, _user.last_name] : _chat.title withColor:NSColorFromRGB(0x000000)];


Expand Down
2 changes: 1 addition & 1 deletion TGShare/TGS_MTNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-(void)sendRequest:(TGS_RPCRequest *)request forDatacenter:(int)datacenterId;
-(void)sendRandomRequest:(TGS_RPCRequest *)request;
-(MTDatacenterAuthInfo *)authInfoForDatacenter:(int)dc_id;
-(MTKeychain *)keyChain;
-(id<MTKeychain>)keyChain;
-(void)successAuthForDatacenter:(int)dc_id;
-(BOOL)isAuth;
-(int)getTime;
Expand Down
7 changes: 3 additions & 4 deletions TGShare/TGS_MTNetwork.m
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,9 @@ -(void)startWithKeychain:(TGKeychain *)keychain {
_datacenterCount = 5;


NSString *address = @"149.154.175.50";

[_context setSeedAddressSetForDatacenterWithId:1 seedAddressSet:[[MTDatacenterAddressSet alloc] initWithAddressList:@[[[MTDatacenterAddress alloc] initWithIp:address port:443]]]];
NSString *address = @"149.154.167.51";

[_context setSeedAddressSetForDatacenterWithId:2 seedAddressSet:[[MTDatacenterAddressSet alloc] initWithAddressList:@[[[MTDatacenterAddress alloc] initWithIp:address port:443 preferForMedia:NO]]]];

}

Expand Down Expand Up @@ -379,7 +378,7 @@ -(int)getUserId {
return [[_keychain objectForKey:@"user_id" group:@"persistent"] intValue];
}

-(MTKeychain *)keyChain {
-(id<MTKeychain>)keyChain {
return _context.keychain;
}

Expand Down
4 changes: 1 addition & 3 deletions TGShare/TGShare.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>group.ru.keepcoder.Telegram</string>
</array>
<array/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
Expand Down
6 changes: 6 additions & 0 deletions Telegram.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array/>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.device.microphone</key>
Expand All @@ -20,5 +22,9 @@
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)ru.keepcoder.Telegram</string>
</array>
</dict>
</plist>
35 changes: 20 additions & 15 deletions Telegram.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@
C26E802A1B7E00A1003CC483 /* TGRecentSearchRowItem.m in Sources */ = {isa = PBXBuildFile; fileRef = C26E80291B7E00A1003CC483 /* TGRecentSearchRowItem.m */; };
C26E802D1B7E00C3003CC483 /* TGRecentSearchRowView.m in Sources */ = {isa = PBXBuildFile; fileRef = C26E802C1B7E00C3003CC483 /* TGRecentSearchRowView.m */; };
C26E80301B7E106B003CC483 /* TGRecentSearchTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = C26E802F1B7E106B003CC483 /* TGRecentSearchTableView.m */; };
C26E80341B8369B1003CC483 /* MtProtoKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C2D8261B1B6FA8A600434D37 /* MtProtoKit.framework */; };
C26F7EA21A4C32DB001D1AE2 /* TGAllStickersTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = C26F7EA11A4C32DB001D1AE2 /* TGAllStickersTableView.m */; };
C26F7EA81A56BEFE001D1AE2 /* SecretLayer20.m in Sources */ = {isa = PBXBuildFile; fileRef = C26F7EA71A56BEFE001D1AE2 /* SecretLayer20.m */; };
C26F7EAF1A56E5A1001D1AE2 /* AcceptKeySecretSenderItem.m in Sources */ = {isa = PBXBuildFile; fileRef = C26F7EAE1A56E5A1001D1AE2 /* AcceptKeySecretSenderItem.m */; };
Expand Down Expand Up @@ -751,10 +752,6 @@
C2D5CE841B0B938B009F6419 /* SpacemanBlocks.h in Sources */ = {isa = PBXBuildFile; fileRef = CEA589441815827500462DF0 /* SpacemanBlocks.h */; };
C2D7C5B11B2B4FAF0042DC01 /* TGMenuItemPhoto.m in Sources */ = {isa = PBXBuildFile; fileRef = C2D7C5B01B2B4FAF0042DC01 /* TGMenuItemPhoto.m */; };
C2D7C5BE1B3091400042DC01 /* StartBotSenderItem.m in Sources */ = {isa = PBXBuildFile; fileRef = C2D7C5BD1B3091400042DC01 /* StartBotSenderItem.m */; };
C2D825C31B664EC500434D37 /* Sparkle.framework in Copy Files (6 items) */ = {isa = PBXBuildFile; fileRef = C235364C19C88D620044978E /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
C2D825C41B664EC500434D37 /* HockeySDK.framework in Copy Files (6 items) */ = {isa = PBXBuildFile; fileRef = C2082B7219C1E1C4000005E2 /* HockeySDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
C2D825C51B664ECA00434D37 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C235364C19C88D620044978E /* Sparkle.framework */; };
C2D825C61B664ECA00434D37 /* HockeySDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C2082B7219C1E1C4000005E2 /* HockeySDK.framework */; };
C2D825D61B67B22E00434D37 /* CacheSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C2D825D51B67B22E00434D37 /* CacheSettingsViewController.m */; };
C2D825E01B690D7500434D37 /* NotificationSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C2D825DF1B690D7500434D37 /* NotificationSettingsViewController.m */; };
C2D825E31B69155D00434D37 /* NotificationConversationRowItem.m in Sources */ = {isa = PBXBuildFile; fileRef = C2D825E21B69155D00434D37 /* NotificationConversationRowItem.m */; };
Expand All @@ -766,6 +763,10 @@
C2D8263F1B7110AB00434D37 /* TGConversation.m in Sources */ = {isa = PBXBuildFile; fileRef = C2D8263E1B7110AB00434D37 /* TGConversation.m */; };
C2D826421B71155000434D37 /* TGDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = C2D826411B71155000434D37 /* TGDatabase.m */; };
C2D826491B74FD5D00434D37 /* TGPVZoomControl.m in Sources */ = {isa = PBXBuildFile; fileRef = C2D826481B74FD5D00434D37 /* TGPVZoomControl.m */; };
C2D8CFB61B83DA6600080775 /* Sparkle.framework in Copy Files (6 items) */ = {isa = PBXBuildFile; fileRef = C235364C19C88D620044978E /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
C2D8CFB71B83DA6600080775 /* HockeySDK.framework in Copy Files (6 items) */ = {isa = PBXBuildFile; fileRef = C2082B7219C1E1C4000005E2 /* HockeySDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
C2D8CFB81B83DA7000080775 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C235364C19C88D620044978E /* Sparkle.framework */; };
C2D8CFB91B83DA7000080775 /* HockeySDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C2082B7219C1E1C4000005E2 /* HockeySDK.framework */; };
C2D931401991140F00668F86 /* TGWindowArchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = C2D9313F1991140F00668F86 /* TGWindowArchiver.m */; };
C2DE4FAB1AD08C34001EC26C /* TGWebpageArticle.m in Sources */ = {isa = PBXBuildFile; fileRef = C2DE4FAA1AD08C34001EC26C /* TGWebpageArticle.m */; };
C2DE4FAE1AD08C47001EC26C /* TGWebpageArticleContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = C2DE4FAD1AD08C47001EC26C /* TGWebpageArticleContainer.m */; };
Expand Down Expand Up @@ -931,8 +932,8 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
C2D825C31B664EC500434D37 /* Sparkle.framework in Copy Files (6 items) */,
C2D825C41B664EC500434D37 /* HockeySDK.framework in Copy Files (6 items) */,
C2D8CFB61B83DA6600080775 /* Sparkle.framework in Copy Files (6 items) */,
C2D8CFB71B83DA6600080775 /* HockeySDK.framework in Copy Files (6 items) */,
);
name = "Copy Files (6 items)";
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -2542,6 +2543,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C26E80341B8369B1003CC483 /* MtProtoKit.framework in Frameworks */,
C2CBF6A21AFB81A8006BF90A /* QuickLook.framework in Frameworks */,
C2CBF6851AFB6FE6006BF90A /* QuartzCore.framework in Frameworks */,
C2CBF6831AFB6F33006BF90A /* AVFoundation.framework in Frameworks */,
Expand Down Expand Up @@ -2596,8 +2598,8 @@
CEB0A23517DB03E00055F150 /* Security.framework in Frameworks */,
CEB09E5C17DAFC250055F150 /* Cocoa.framework in Frameworks */,
CEB0D71618E0CBB000457D08 /* libopus.a in Frameworks */,
C2D825C51B664ECA00434D37 /* Sparkle.framework in Frameworks */,
C2D825C61B664ECA00434D37 /* HockeySDK.framework in Frameworks */,
C2D8CFB81B83DA7000080775 /* Sparkle.framework in Frameworks */,
C2D8CFB91B83DA7000080775 /* HockeySDK.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -5650,7 +5652,7 @@
DevelopmentTeam = 6N38VWS5BX;
SystemCapabilities = {
com.apple.ApplicationGroups.Mac = {
enabled = 1;
enabled = 0;
};
com.apple.Keychain = {
enabled = 1;
Expand All @@ -5670,7 +5672,7 @@
enabled = 0;
};
com.apple.Keychain = {
enabled = 0;
enabled = 1;
};
com.apple.Mac = {
enabled = 0;
Expand Down Expand Up @@ -6762,9 +6764,9 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_ENTITLEMENTS = TGShare/TGShare.entitlements;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "Mac Developer";
"CODE_SIGN_IDENTITY[sdk=*]" = "";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -6792,7 +6794,7 @@
OTHER_CODE_SIGN_FLAGS = "";
"OTHER_CODE_SIGN_FLAGS[sdk=*]" = "--deep";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "9b5f6bc3-32b1-4737-bbea-c772320d3813";
PROVISIONING_PROFILE = "1c746dc7-fbd8-40fe-8897-361d3f52bd07";
SDKROOT = macosx;
SKIP_INSTALL = YES;
};
Expand All @@ -6808,7 +6810,8 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_ENTITLEMENTS = TGShare/TGShare.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "";
CODE_SIGN_IDENTITY = "Mac Developer";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
ENABLE_NS_ASSERTIONS = NO;
Expand All @@ -6833,7 +6836,7 @@
OTHER_CODE_SIGN_FLAGS = "";
"OTHER_CODE_SIGN_FLAGS[sdk=*]" = "--deep";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "9b5f6bc3-32b1-4737-bbea-c772320d3813";
PROVISIONING_PROFILE = "1c746dc7-fbd8-40fe-8897-361d3f52bd07";
SDKROOT = macosx;
SKIP_INSTALL = YES;
};
Expand Down Expand Up @@ -6905,6 +6908,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Telegram.entitlements;
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -6951,6 +6955,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Telegram.entitlements;
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Loading

0 comments on commit 8ef5497

Please sign in to comment.